import { useState, useEffect } from 'react';

export const App = () => {
  const [count, setCount] = useState(0);
  const [number, setNumber] = useState(0);

  // 错误演示：没设置
  useEffect(() => {
    document.title = '点击了' + count + '次';
  }, [count]);

  // 错误演示：设置错误
  useEffect(() => {
    document.title = '点击了' + count + '次2';
  }, [count]);

  return (
    <div>
      <h1>
        计数器：{count}, {number}
      </h1>
      <button onClick={() => setCount(count + 1)}>+1</button>
    </div>
  );
};
